package com.zw.design.pattern.creational.structural.flyweight;

import java.util.HashMap;
import java.util.Map;

public class EmpployeeFactory {

    private static final Map<String, Empployee> EMPPLOYEE_MAP = new HashMap<String, Empployee>();

    public static Empployee getManager(String department) {
        Manager manager = (Manager) EMPPLOYEE_MAP.get(department);
        if (manager == null) {
            manager = new Manager(department);
            System.out.println("manager部门经理 = " + department);
            String str=department+" 部门汇报:此次报告主要内容是。。。。。";
            manager.setReportContent(str);
            System.out.println("创建报告 = " + str);
            EMPPLOYEE_MAP.put(department, manager);
        }
        return manager;
    }
}
